﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using AttributeRouting;
using AttributeRouting.Web.Mvc;
using Newtonsoft.Json.Linq;

using Invoicing.Model.Results;
using Invoicing.Model.Products;
using Invoicing.Logic.Products;
namespace Invoicing.Web.Management.Areas.Products.Controllers
{
    [RouteArea("Products")]
    [RoutePrefix("Process")]
    [Authorize]
    public class ProductProcessApiController : ApiController
    {
        [Route("Gets")]
        [HttpPost]
        public JsonEntitySet<ProductProcessModel> Gets(JObject request)
        {
            string errinfo = "no data";
            try
            {
                var result = ProductProcessLogic.GetAll();
                return new JsonEntitySet<ProductProcessModel>(result);
            }
            catch (Exception ex)
            {
                errinfo = ex.Message;
                Common.Logger.Error("", ex);
            }
            return new JsonEntitySet<ProductProcessModel>(null, errinfo, false);
        }
    }
}
